<?php
/** 
 */
namespace data\model;

use data\model\BaseModel as BaseModel;
/**
 * 前台留言视图表
 * @author Administrator
 *
 */
class NsMessageViewModel extends BaseModel {
    protected $table = 'ns_message';
    /**
     * 获取列表返回数据格式
     * @param unknown $page_index
     * @param unknown $page_size
     * @param unknown $condition
     * @param unknown $order
     * @return unknown
     */
    public function getViewList($page_index, $page_size, $condition, $order){
    
        $queryList = $this->getViewQuery($page_index, $page_size, $condition, $order);

        $queryCount = $this->getViewCount($condition);

        $list = $this->setReturnList($queryList, $queryCount, $page_size);
        return $list;
    }
    /**
     * 获取列表
     * @param unknown $page_index
     * @param unknown $page_size
     * @param unknown $condition
     * @param unknown $order
     * @return \data\model\multitype:number
     */
    public function getViewQuery($page_index, $page_size, $condition, $order)
    {
        //设置查询视图
        $viewObj = $this->alias('nm')
        ->join('sys_user su','nm.uid= su.uid','left')
        /*->field('nm.content,nm.create_ime,nm.status,su.user_name')*/;
        $list = $this->viewPageQuery($viewObj, $page_index, $page_size, $condition, $order);
        return $list;
    }
    /**
     * 获取列表数量
     * @param unknown $condition
     * @return \data\model\unknown
     */
    public function getViewCount($condition)
    {
        $viewObj = $this->alias('nm')
        /*->join('ns_member_level nml','nm.member_level = nml.level_id','left')
        ->join('sys_user su','nm.uid= su.uid','left')*/
        ->field('nm.uid');
        $count = $this->viewCount($viewObj,$condition);
        return $count;
    }

}
